home *** CD-ROM | disk | FTP | other *** search
/ Atlas of Florida / Atlas of Florida.iso / Movies / 5.0 Economy / 00381_Script_381 < prev    next >
Text File  |  1994-08-23  |  7KB  |  255 lines

  1. --
  2. --  Movie scripts version 1.3  -  6/7/94
  3. --  All scripts written by David May.
  4. --
  5.  
  6. on startMovie
  7.   
  8.   openXlib "PrintField XCMD"
  9.   openResFile "Atlas.rsrc"
  10.   readGlossary "Glossaries:5.0 glossary"
  11.   
  12.   set the keyDownScript = "checkKey"
  13. end startMovie
  14.  
  15.  
  16. on stopMovie
  17.   closeXlib "PrintField XCMD"
  18.   closeResFile "Atlas.rsrc"
  19. end stopMovie
  20.  
  21.  
  22. on checkKey                                  -- Checks for command-key combinations
  23.   global textOpen, currentOpen, textChannel
  24.   
  25.   if (the key = "p") and (the commandDown) and textOpen then
  26.     if currentOpen <> 0 then set textChannel = currentOpen
  27.     put the castNum of sprite textChannel into theNum
  28.     printText theNum
  29.   end if
  30.   
  31. end checkKey
  32.  
  33.  
  34. on setupText text,def                        -- This sets up the global variables and hides the proper channels
  35.   global textOpen, defChannel, textChannel   --    when using a single popup text field and definition field
  36.   
  37.   if (text=0) and (def=0) then
  38.     set textOpen=false
  39.     showChannel textChannel
  40.     showChannel defChannel
  41.   else
  42.     showChannel textChannel
  43.     showChannel defChannel
  44.     set textOpen = false
  45.     set textChannel = text
  46.     set defChannel = def
  47.     hideChannel textChannel
  48.     hideChannel defChannel
  49.   end if
  50.   
  51. end setupText
  52.  
  53.  
  54. on multiText  which                          -- This code handles multiple text fields on a page
  55.   global currentOpen, textOpen
  56.   
  57.   if currentOpen = which then
  58.     hideChannel which
  59.     updateStage
  60.     set currentOpen = 0
  61.     set textOpen = false
  62.     exit
  63.   end if
  64.   
  65.   if currentOpen <> 0 then hideChannel currentOpen
  66.   
  67.   showChannel which
  68.   set currentOpen = which
  69.   set textOpen to true
  70. end multiText
  71.  
  72.  
  73. on readText filename                         -- Reads in a text file "fileName" into "the result"
  74.   
  75.   set filename = the pathName & filename     -- Use the pathname of the movie + the desired name
  76.   set file = FileIO(mNew, "read", fileName)  -- Create a new instance of the FileIO XObject
  77.   
  78.   
  79.   if not objectp(file) then                  -- If the file couldn't be opened then exit gracefully.
  80.     return ""                                -- To do error checking, put a value in here
  81.   end if
  82.   
  83.   set s = file(mreadfile)                    -- Use our new object to read in the file
  84.   file(mDispose)                             -- Dispose of our file object
  85.   
  86.   if s <> "" then                            -- If there was any text in the file,
  87.     return s
  88.   else
  89.     return ""
  90.   end if
  91. end readText
  92.  
  93.  
  94. on writeText fileName, theField              -- Writes out a text file containing the contents of "theField"
  95.   
  96.   set file = FileIO(mNew, "?write", fileName)
  97.   
  98.   if not objectp(file) then
  99.     return false    
  100.   else    
  101.     set s = the text of field theField
  102.     file(mWriteString,s)    
  103.   end if
  104.   
  105.   file(mDispose)
  106.   
  107. end writeText
  108.  
  109.  
  110. on printText theField                        -- Prints out the text field with castNum of "theField"
  111.   
  112.   set aName = CallBackTracer(mNew)
  113.   SetCallBack PrintDoc, aName
  114.   
  115.   --parameter strings
  116.   set PageHeader = ""
  117.   set container = the text of cast theField
  118.   set PrintDialogString = ""
  119.   set FontName = "times"
  120.   set FontSize = "12"
  121.   set BooleanSetUp = "true"
  122.   
  123.   --command line
  124.   PrintDoc PageHeader, container, PrintDialogString, FontName, FontSize, BooleanSetUp
  125.   
  126.   
  127.   --this factory to bypass some message form the XCMD
  128. factory CallBackTracer
  129.   
  130. method mNew
  131. method mSendHCMessage x
  132. method mSendCardMessage x
  133.   
  134. end printText
  135.  
  136.  
  137. on readGlossary glossFile                    -- Reads in a glossary file into the global "gGlossary"
  138.   global gGlossary
  139.   readText glossFile
  140.   if (the result = "") then                  -- If an error occurred then,
  141.     alert "The glossary could not be found!" -- Display the appropriate error box.
  142.     put "" into gGlossary
  143.   else
  144.     put the result into gGlossary
  145.     return the result  
  146.   end if
  147. end readGlossary
  148.  
  149.  
  150. on readDefinition def                        -- Reads in the definition "def" from disk and puts it in the def. field
  151.   global defChannel
  152.   put the castNum of sprite defChannel into defField
  153.   readText "Definitions:" & def
  154.   if (the result = "") then                  -- If an error occurred then,
  155.     alert "The definition " & quote & def & quote & " could not be found!"
  156.     put empty into field defField
  157.     return false
  158.   else
  159.     put the result into field defField
  160.     return true
  161.   end if
  162. end readDefinition
  163.  
  164.  
  165. on waitForMouse
  166.   repeat while (not the mouseDown)           -- Loop until the mouse is clicked
  167.   end repeat
  168.   
  169.   openXLib "Johnny.xobj"                     -- Use the XObject "Johnny" to flush the event queue
  170.   set myFlush=johnny(mnew)                   -- so that Director won't recieve the mouse click
  171.   myflush(mflush)
  172.   myflush(mdispose)
  173.   closeXLib "Johnny.xobj"
  174. end waitForMouse
  175.  
  176.  
  177. on removePunc theWord                                        -- Will strip out the characters in "puncMarks" from "theWord"
  178.   
  179.   put ".!?,();:" & return & quote into puncMarks             -- faster this way
  180.   
  181.   put "" into newWord                                        -- Initialize our variable
  182.   
  183.   repeat with temp = 1 to (length(theWord))                  -- Repeat for all characters in the word
  184.     if not (puncMarks contains (char temp of theWord)) then  -- If the character isn't punctuation,
  185.       put char temp of theWord after newWord                 -- Copy it over to the new word
  186.     end if
  187.   end repeat
  188.   
  189.   return newWord                                             -- Return our new word, without punctuation
  190.   
  191. end removePunc
  192.  
  193.  
  194. on toggleChannel which                       -- Toggle the visibility of channel "which"
  195.   puppetSprite which,true
  196.   set the visibility of sprite which to (not the visibility of sprite which)
  197.   updateStage
  198.   puppetSprite which,false
  199. end toggleChannel
  200.  
  201.  
  202. on showChannel which                         -- Show the channel "which"
  203.   puppetSprite which,true
  204.   set the visibility of sprite which to true
  205.   --updateStage
  206.   puppetSprite which,false
  207. end showChannel
  208.  
  209.  
  210. on showAllChannels                           -- Show all channels
  211.   repeat with x = 1 to 48
  212.     puppetSprite x,true
  213.     set the visibility of sprite x to true
  214.     puppetSprite x,false
  215.   end repeat
  216. end showAllChannels
  217.  
  218.  
  219. on hideChannel which                         -- Hide the channel "which"
  220.   puppetSprite which,true
  221.   set the visibility of sprite which to false
  222.   --updateStage
  223.   puppetSprite which,false
  224. end hideChannel
  225.  
  226.  
  227. on clearCursors                              -- Will reset the cursor for all sprites to an arrow
  228.   repeat with x = 1 to 48
  229.     set the cursor of sprite x to 0
  230.   end repeat    
  231. end clearCursors
  232.  
  233.  
  234. on clearCursor which                         -- Will reset the cursor for sprite "which" to an arrow
  235.   set the cursor of sprite which to 0
  236. end clearCursor
  237.  
  238.  
  239. on setCursors whichOnes, curs                -- Will set the cursor of sprites "whichOnes" to a hand
  240.   -- Use the form "4,5,6" for whichOnes
  241.   clearCursors
  242.   
  243.   repeat with x = 1 to (the number of items in whichOnes)
  244.     put integer(item x of whichOnes) into i
  245.     set the cursor of sprite i to 5
  246.   end repeat
  247. end setCursors
  248.  
  249.  
  250. on setCursor which, curs                     -- Will set the cursor for sprite "which" to a hand
  251.   set the cursor of sprite which to 5
  252. end setCursor
  253.  
  254.  
  255.